import java.util.GregorianCalendar;
import java.util.Scanner;

public class Ui {
	private HeadOfTheGroup head;
	private Group firstGroup;
	private Deanery dean;
	private Subject[] curriculum;
	private Teacher teacher;
	private Student[] students;
	private Scanner in = new Scanner(System.in);
	private int inputedNumber;

	private void studentSelect() {
		if (inputedNumber == 1) {
			System.out.println("Please, enter your group");
			String inputedString = in.next();
			if (inputedString.equalsIgnoreCase("Kv-71")) {
				head.printStudentContacts(firstGroup, new Student(
						"Timur Suleimanov", "233-24-55"), head, new Student(
						"Vasa Pupkin", "234-03-02"));
				head.printDeaneryContacts(dean);
			}
		}
	}

	private void deanSelect() {
		if (inputedNumber == 2) {
			dean.printCurriculum(curriculum);
			System.out
					.printf("To add a student please enter (1)\nTo delete a student, please enter (2)");
			int inputedInt = in.nextInt();
			firstGroup.setStudents(students);
			if (inputedInt == 1) {
				students = firstGroup.addStudent(firstGroup, new Student(
						"Lera", "666-666-666"));
				head.printStudentContacts(firstGroup, students);
			} else if (inputedInt == 2) {
				students = firstGroup.deleteStudent(firstGroup, students[0]);
				head.printStudentContacts(firstGroup, students);
			}
		}
	}

	private void teacherSelect() {
		if (inputedNumber == 3) {
			System.out.println("Please,enter your name");
			String inputedString = in.next();
			if (inputedString.equalsIgnoreCase("Bohanov")) {
				System.out.printf(teacher.getExamShedule(curriculum[0]));
			}
		}
	}

	private void generalSelect() {
		System.out
				.printf("Are you a student(1)?\nAre you a deanery worker(2)?\nAre you a teacher(3)?\n");
		Scanner in = new Scanner(System.in);
		inputedNumber = in.nextInt();
	}

	private void init() {
		this.head = new HeadOfTheGroup("Valera", "34-32-12");
		this.dean = new Deanery("\"Kyiv,pr.Kovalsky 5\"", "650-34-12");
		this.curriculum = new Subject[2];
		GregorianCalendar mathExam = new GregorianCalendar(2011, 10, 2);
		curriculum[0] = new Subject("Math", 34, mathExam);
		this.teacher = new Teacher("Bohanov", "66-66-66", "professor",
				curriculum[0]);
		this.firstGroup = new Group("Kv-71");
		students = new Student[3];
		students[0] = new Student("Timur Suleimanov", "233-24-55");
		students[1] = new Student("Vasya Pupkin", "234-03-02");
		students[2] = head;
	}

	public void makeInterface() {
		init();
		generalSelect();
		studentSelect();
		deanSelect();
		teacherSelect();
	}

}